package se.webbzon.boltzmann.battle.property;

import se.webbzon.boltzmann.battle.strategy.AbstractStrategy;
import se.webbzon.boltzmann.effect.Effect;
import se.webbzon.oschi01.worldarea.WorldArea;

public class BattleBuffEffectLinker implements BattlePropertyListener {
	
	// The world where the link is contained
	private final WorldArea world;
	
	// The effect contained within this link
	private final Effect effect;
	
	// The battle buff contained within this linked
	private final BattleBuff buff;
	
	/*============================================================
	Constructors
	============================================================*/
	
	/** Creates a battle buff effect link in a given world. The given effect will
	 * be terminated when the given battle buff expires. **/
	public BattleBuffEffectLinker(WorldArea world, Effect effect, BattleBuff buff) {
		this.world = world;
		this.effect = effect;
		this.buff = buff;
	}
	
	/*============================================================
	Public Methods
	============================================================*/

	@Override public void onSetMaxHealth(BattleProperty property, int maxHealth) {};

	@Override public void onSetHealth(BattleProperty property, int health) {};

	@Override public void onSetMaxEnergy(BattleProperty property, int maxEnergy) {};

	@Override public void onSetEnergy(BattleProperty property, int energy) {};

	@Override public void onSetStrategy(BattleProperty property,
			AbstractStrategy strategy) {};

	@Override public void onBuffAdd(BattleProperty property, BattleBuff buff) {};

	@Override public void onBuffRemove(BattleProperty property, BattleBuff buff) {
		if (buff == this.buff)
			effect.terminate(world);
	}
	
}